package com.zmj.proxy.cglib;

import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

public class LoggerInterceptor implements MethodInterceptor {

    public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {

        LogManager.start();

        //执行目标代理的父类方法;
        Object result = methodProxy.invokeSuper(o, objects);

        LogManager.end();
        return result;
    }

}
